// yb_shop/pages/paycontent/userorder/index.js

var app = getApp(),
  api = app.requirejs("api/index"),
  core = app.requirejs("core");

Page({

  data: {
    list: [],
    page: 1,
    end:false,
  },

  onLoad: function (options) {

    var that = this,
      e = {};
    getApp().getExtC(function () {
    core.get("paycontent/likes", {
      uid: app.getCache("userinfo").uid,
    }, function (t) {
      if (t.code == 1) {
        if (t.info.length > 0) {

          if (that.data.page == 1) {
            e.list = t.info;
          }
          else {
            e.list = that.data.list.concat(t.info);
          }
          e.page = that.data.page + 1;
          that.setData(e);

        }
        else
        {
          that.setData({
            end:true
          });
        }

      } else {
        core.alert(t.msg)
      }
    }, true)
    })
  },

  onReady: function () {

  },

  onShow: function () {

  },

  onHide: function () {

  },

  onUnload: function () {

  },

  onPullDownRefresh: function () {

  },

  onReachBottom: function () {

    if(!this.data.end)
    {
      this.onLoad(null);
    }

  },

  onShareAppMessage: function () {

  }
})